﻿@Html.DevExpress().Spreadsheet(
    settings =>
    {
        settings.Name = "spreadsheet";
        settings.CallbackRouteValues = new { Controller = "Report", Action = "SpreadSheetViewerPartial" };
        settings.CustomActionRouteValues = new { Controller = "Report", Action = "SpreadCalcbackCommand" };
        settings.Width = Unit.Percentage(100);
        settings.Height = Unit.Percentage(100);
        settings.ActiveTabIndex = 0;
        settings.ShowConfirmOnLosingChanges = false;
        settings.WorkDirectory = SpreadSheetViewer.Helper.DirectoryManagmentUtils.DocumentBrowsingFolderPath;
        settings.SettingsDocumentSelector.UploadSettings.Enabled = true;
        settings.RibbonMode = SpreadsheetRibbonMode.None;
        //settings.FullscreenMode = true;
        settings.PreRender += (s, _) =>
        {
            MVCxSpreadsheet spreadsheet = (MVCxSpreadsheet)s;
            //spreadsheet.Document.LoadDocument(Path.Combine(SpreadSheetViewer.Helper.DirectoryManagmentUtils.DocumentBrowsingFolderPath, "BreakevenAnalysis.xlsx"));
            spreadsheet.Document.Options.CalculationMode = DevExpress.Spreadsheet.WorkbookCalculationMode.Automatic;
            Session["Spread"] = spreadsheet.Document;
        };
        settings.ClientSideEvents.BeginCallback = "ReportViewerStaticClass.OnSpreadsheetBeginCallback";
        settings.ClientSideEvents.EndCallback = "ReportViewerStaticClass.OnSpreadsheetEndCallback";
    }
).GetHtml()